import org.junit.Test;

import java.sql.*;
import java.util.Calendar;


public class Dtest {

    @Test
    public void test() throws Exception{
        Class.forName("org.sqlite.JDBC");
        Connection connection = DriverManager.getConnection("jdbc:sqlite:/Users/admin/codespace/chunfen-demo/wireless-activity-demo/wa.db");

        PreparedStatement preparedStatement = connection.prepareStatement("select * from user");
//        PreparedStatement preparedStatement = connection.prepareStatement("insert into user values(?, ?, ?)");
//        preparedStatement.setInt(1, 1);
//        preparedStatement.setString(2, "Tom");
//        preparedStatement.setDate(3, new Date(System.currentTimeMillis()));
//        preparedStatement.execute();

        ResultSet resultSet = preparedStatement.executeQuery();

        while (resultSet.next()){
            int id = resultSet.getInt(1);
            String name = resultSet.getString(2);
            long date = resultSet.getLong(3);
            System.out.println(name +"|"+id+"|"+ date);
        }
//
        resultSet.close();
        preparedStatement.close();
        connection.close();


    }
}
